deploy-gitlab-job:
  image: python:3.10-alpine
  stage: deploy
  only:
    - main
  before_script:
    - pip install -r requirements.txt  
    - apk add curl
    - curl -sSL https://install.python-poetry.org | python3 -
    - export PATH="/root/.local/bin:$PATH"
    - poetry --version
  script: 
    - poetry build
    - poetry config repositories.gitlab "https://gitlab.com/api/v4/projects/$CI_PROJECT_ID/packages/pypi"
    - poetry config http-basic.gitlab gitlab-ci-token "$CI_JOB_TOKEN"
    - poetry publish --repository gitlab
  environment: production

deploy-pypi-job:
  image: python:3.10-alpine
  stage: deploy
  only:
    - main
  before_script:
    - pip install -r requirements.txt  
    - apk add curl
    - curl -sSL https://install.python-poetry.org | python3 -
    - export PATH="/root/.local/bin:$PATH"
    - poetry --version
  script: 
    - poetry build
    - poetry config pypi-token.pypi $pypi_token
    - poetry publish
  environment: production
